<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>泮河校区会议室预约系统</title>
    <meta name="keywords" content="H+后台主题,后台bootstrap框架,会员中心主题,后台HTML,响应式后台">
    <meta name="description" content="H+是一个完全响应式，基于Bootstrap3最新版本开发的扁平化主题，她采用了主流的左右两栏式布局，使用了Html5+CSS3等现代技术">

    <link rel="shortcut icon" href="favicon.ico">
    <link href="css/bootstrap.min.css-v=3.3.5.css"
          tppabs="http://www.zi-han.net/theme/hplus/css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="css/font-awesome.min.css-v=4.4.0.css"
          tppabs="http://www.zi-han.net/theme/hplus/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="css/plugins/iCheck/custom.css"
          tppabs="http://www.zi-han.net/theme/hplus/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="css/animate.min.css" tppabs="http://www.zi-han.net/theme/hplus/css/animate.min.css"
          rel="stylesheet">
    <link href="css/style.min.css-v=4.0.0.css" tppabs="http://www.zi-han.net/theme/hplus/css/style.min.css?v=4.0.0"
          rel="stylesheet">
    <base target="_blank">
    <link rel="stylesheet" type="text/css" href="./layui/css/layui.css"/>
    <style>
        #zhuti {
            height: 100%;

        }

        #zhuti::before {
            background: url('img/logo1.png') no-repeat fixed center;
            content: "";
            opacity: 0.2;
            /*//透明度设置*/
            /*z-index:-1;*/
            width: 100%;
            height: 105%;
            position: absolute;
        }
    </style>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">

    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins" id="zhuti">
                <div class="ibox-title">
                    <h3 style="font-weight: 600;margin-top: 0;">修改会议室</h3>
                </div>
                <div class="ibox-content">
                    <div method="post" id="bigform" autocomplete="off" class="form-horizontal">
                        <div class="form-group" style="margin-bottom: 0px;">
                            <label class="col-sm-2 control-label">会议室名称</label>
                            <!-- col-sm-4 m-l-n -->
                            <div class="col-sm-3">
                                <input type="text" id="meetingName" required placeholder="请输入会议室名称"
                                       class="form-control">
                            </div>
                            <label class="col-sm-2 control-label">会议室位置</label>
                            <div class="col-sm-4">
                                <input type="text" id="meetingPosi" required placeholder="请输入会议室位置"
                                       class="form-control">
                            </div>
                        </div>
                        <br>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">会议室资源设备</label>
                            <div class="col-sm-9">
                                <input type="text" id="meetingResor" placeholder="请输入会议室资源设备" class="form-control"
                                       required>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                        <div class="form-group" id="laydate">
                            <label class="col-sm-2 control-label">无线会议话筒数量</label>
                            <div class="col-sm-3">
                                <input type="number" id="micro" placeholder="请输入无线会议话筒数量" required
                                       class="form-control"
                                >
                            </div>

                            <label class="col-sm-2 control-label">无线手持话筒数量</label>
                            <div class="col-sm-4">
                                <input type="number" placeholder="请输入无线手持话筒数量" name="endtime" required
                                       class="form-control"
                                       id="wireless">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">茶杯数量</label>
                            <div class="col-sm-3">
                                <input id="teacup" type="number" name="people" required placeholder="请输入茶杯数量"
                                       class="form-control">
                            </div>
                            <label class="col-sm-2 control-label">会议室最大容量</label>
                            <div class="col-sm-4">
                                <input id="maxSit" type="number" name="people" required placeholder="请输入会议室最大容量"
                                       class="form-control">
                            </div>
                        </div>
                        <br>
                        <div class="form-group">
                            <div class="col-sm-3 col-sm-offset-4">
                                <button name="apply1" onclick="meetingChange()" style="margin-right: 30%;" id="tijiao"
                                        class="btn btn-primary"
                                >修改</button>
                                <a target="_self" href="meetingAdmi.html">
                                <input class="btn btn-white" id="reset1" type="reset" value="返回">
                                </a>
                            </div>
                        </div>
                    </div>
                </div>
                <script src="./layui/layui.js" type="text/javascript" charset="utf-8"></script>
                <script src="js/jquery.min.js-v=2.1.4"
                        tppabs="http://www.zi-han.net/theme/hplus/js/jquery.min.js?v=2.1.4"></script>
                <script src="layui/layer/layer.js" type="text/javascript" charset="utf-8"></script>

                <script src="js/bootstrap.min.js-v=3.3.5"
                        tppabs="http://www.zi-han.net/theme/hplus/js/bootstrap.min.js?v=3.3.5"></script>
                <script src="js/content.min.js-v=1.0.0"
                        tppabs="http://www.zi-han.net/theme/hplus/js/content.min.js?v=1.0.0"></script>
                <script src="js/plugins/iCheck/icheck.min.js"
                        tppabs="http://www.zi-han.net/theme/hplus/js/plugins/iCheck/icheck.min.js"></script>

                <script type="text/javascript" src="../../../tajs.qq.com/stats-sId=9051096"
                        tppabs="http://tajs.qq.com/stats?sId=9051096" charset="UTF-8"></script>
                <script>
                    let id=0;

                    <!--	获取url后边的参数-->
                    function GetRequest() {
                        const url = location.search; //获取url中"?"符后的字串
                        let theRequest = new Object();
                        if (url.indexOf("?") != -1) {
                            let str = url.substr(1);
                            let strs = str.split("&");
                            for (let i = 0; i < strs.length; i++) {
                                theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
                            }
                        }
                        return theRequest;
                    }

                    //页面加载函数入口
                    $(document).ready(function () {
                        let x = GetRequest();
                        id=parseInt(x.id);
                        console.log(id)
                        $.ajax({
                            type: "POST",
                            url: "/user/getAllMeeting",

                            success: function (msg) {
                                console.log(msg)
                                for (let i=0;i<msg.length;i++){
                                    console.log(msg[i].id)
                                    if(msg[i].id==id){
                                        $('#meetingName').val(msg[i].name)
                                        $('#meetingPosi').val(msg[i].site)
                                        $('#meetingResor').val(msg[i].mes)
                                        $('#micro').val(msg[i].micro)
                                        $('#wireless').val(msg[i].wireless)
                                        $('#teacup').val(msg[i].teacup)
                                        $('#maxSit').val(msg[i].maxnum)
                                    }
                                }
                            }
                        })
                    });

                    //添加会议室
                    function meetingChange(){
                        let name=$("#meetingName").val();
                        let posi=$("#meetingPosi").val();
                        let reso=$("#meetingResor").val();
                        let micro=$("#micro").val();
                        let wireless=$("#wireless").val();
                        let teacup=$("#teacup").val();
                        let maxSit=$("#maxSit").val()
                        console.log(id,name,posi,reso,micro,wireless,teacup,maxSit)
                        $.ajax({
                            type: "POST",
                            url: "/admin/changeMeeting",
                            data: {
                                id:id,
                                name: name,
                                site: posi,
                                maxnum: parseInt(maxSit),
                                micro: parseInt(micro),
                                wireless: parseInt(wireless),
                                teacup: parseInt(teacup),
                                mes: reso
                            },
                            success: function (msg) {
                                console.log(msg)
                                layer.alert("修改成功");
                            },
                            error: function (nn) {
                                layer.alert("提交失败");
                                console.log(nn);
                            },
                        });
                    }
                </script>
</body>

</html>
